class Solution:
    def maxArea(self, height: 'List[int]') -> int:
        i = 0
        j = len(height)-1
        res = (j-i) * min(height[i], height[j])
        while i != j:
            res = max((j-i) * min(height[i], height[j]), res)
            if height[i] > height[j]:
                j -= 1
            else:
                i += 1
        return res

if __name__ == "__main__":
    s = Solution()
    print(s.maxArea([1,8,6,2,5,4,8,3,7]))
